package com.briup.cms.service.impl;

import com.briup.cms.bean.Privilege;
import com.briup.cms.dao.PrivilegeMapper;
import com.briup.cms.service.IPrivilegeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class PrivilegeServiceImpl implements IPrivilegeService {
    @Resource
    private PrivilegeMapper privilegeMapper;

    @Override
    public List<Privilege> findAll() {
        return privilegeMapper.selectAll();

    }
    @Override
    public void saveOrUpdate(Privilege privilege) {
        if (privilege.getId() != null) {
            privilegeMapper.update(privilege);
        } else {
            privilegeMapper.insert(privilege);
        }

    }
    @Override
    public void deleteById(long id) {

        privilegeMapper.deleteById(id);

    }
}